package com.tjtt.tdm.form.service;

import java.util.List;
import java.util.Map;

import com.tjtt.tdm.base.PageResult;
import com.tjtt.tdm.flow.bean.FlowDetailed;
import com.tjtt.tdm.flow.bean.FlowTask;
import com.tjtt.tdm.flow.bean.TdmCustomNo;
import com.tjtt.tdm.form.bean.AutoFormsButton;
import com.tjtt.tdm.form.bean.AutoFormsField;
import com.tjtt.tdm.form.bean.AutoFormsNew;

public interface IAutoFormService {

	/**
	 * 创建表
	 * @param tableName
	 * @return
	 */
	public int insertCreateTableSql(AutoFormsNew autoFormNew,String tableName);
	
	/**
	 * 保存对象
	 * @param autoFormNew
	 */
	public String saveAutoFormsNew(AutoFormsNew autoFormNew);
	
	/**
	 * 保存AutoFormsField
	 * @param autoFormsField
	 */
	public void saveAutoFormsField(AutoFormsField autoFormsField);
	
	/**
	 * 创建序列
	 * @param sequencesName
	 * @return
	 */
	public int insertCreateSequencesSql(String sequencesName);
	
	/**
	 * 查询对象列表
	 * @param filterMap
	 * @return
	 */
	public PageResult queryAutoFormsListNew(Map filterMap);
	public PageResult queryAutoFormsListNewData(Map filterMap);
	
	/**
	 * 查询字段对象列表
	 * @param filterMap
	 * @return
	 */
	public PageResult queryAutoFormsFieldListByFormId(Map filterMap);
	public PageResult queryAutoFormsFieldListDicByFormId(Map filterMap);
	
	/**
	 * 根据表英文名称查询
	 * @param formEnName
	 * @return
	 */
	public List queryAutoFormListByFormEnName(String formEnName);
	
	/**
	 * 根据id删除AutoFormsNew
	 * @param id
	 */
	public void deleteAutoFormById(String id);
	
	/**
	 * 根据id删除表字段信息
	 * @param formId
	 */
	public void deleteAutoFormFieldByFormId(String formId);
	
	/**
	 * 删除表和序列和数据
	 * @param tableName
	 */
	public void deleteTableAndSeqAndDateByFormName(String tableName,String formId);
	
	/**
	 * 根据现有的表查询出表的字段名称，类型，中文名称
	 * @param tableName
	 */
	public List getTableColumnAndCommentAndDataType(String tableName);
	
	/**
	 * 查询对象AutoFormsNew
	 * @param formId
	 * @return
	 */
	public AutoFormsNew getAutoFormsNewById(String formId);
	/**
	 * 查询表单的所有的字段
	 * author:lishu	 2013-10-25
	 */
	public List<AutoFormsField> getAutoFormsFieldByformid(String formid);
	/**
	 * 获取表单的数据
	 * author:lishu	 2014-1-9
	 */
	public List getAutoFormsFieldValues(String formid,String formName,String taskid);
	/**
	 * 添加数据库表字段（根据表名）
	 * @param tableName
	 */
	public void addFormFieldByTable(String tableName,AutoFormsField autoFormsField,String formId);
	
	/**
	 * 根据id查询对象（AutoFormsField）
	 * @param id
	 * @return
	 */
	public AutoFormsField getAutoFormFieldById(String id);
	
	/**
	 * 修改对象
	 * @param id
	 */
	public void updateAutoFormField(AutoFormsField autoFormsField);
	
	/**
	 * 删除字段
	 * @param fieldId
	 * @param tableName
	 * @param columnName
	 */
	public void deleteAutoFormFieldBeanAndTableColumn(String fieldId,String tableName,String columnName);
	
	/**
	 * 修改AutoFormsNew对象
	 * @param autoFormNew
	 */
	public void updateAutoForm(AutoFormsNew autoFormNew);
	
	/**
	 * 根据sql语句查询字段
	 */ 
	public List getDatabySql(String sql);
	
	/**
	 * 执行sql语句
	 */
	public String executeSql(String sql);
	
	/**
	 * 查询button管理列表
	 * @param filterMap
	 * @return
	 */
	public PageResult queryAutoFormsButtonList(Map filterMap);
	
	/**
	 * 保存按钮对象
	 * @param autoFormsButton
	 */
	public void saveAutoFormsButton(AutoFormsButton autoFormsButton);
	
	/**
	 * 根据id删除button
	 * @param ids
	 */
	public void deleteAutoFormsButtonById(String ids);

	public void deleteFlowTaskById(String ids);

	public PageResult queryAutoFormsField(Map<String, String> filterMap);

	public void removeView(String ids);

	public FlowTask getFlowTaskById(Long ids);

	public void deleteFormTable(Long mainId, String formEnName);
	
	/**
	 * 查询出按钮
	 * @param id
	 * @return
	 */
	public AutoFormsButton getAutoFormButtonById(String id);
	
	/**
	 * 修改button
	 * @param afb
	 */
	public void updateAutoFormButton(AutoFormsButton afb);
	public PageResult queryProjectTask(Map filterMap);
	/**
	 * 查询此表中是否存在此字段名称
	 * @author zhn
	 * @date Feb 17, 2014 2:27:16 PM
	 * @param fieldName
	 * @return
	 */
	public String findFieldName(String fieldName,String formId);

	public void insertDetailTable(String formEnName);

	public void insertTable(String formId,String tableCnName,String tableName,String formEnName);

	public String queryNo(String auToFormNewId);

	public String saveFlowTask(FlowTask flowTask1);

	public void saveFlowDetailed(FlowDetailed flowDetailed);

	public void updateFlowDetailed(String taskId, String string,
			String string2, String string3, String string4,String nextUserId,String nextRoleId);
	
	/**
	 * 保存编号规则
	 * @param tcn
	 */
	public void saveCustomNo(TdmCustomNo tcn);
	
	/**
	 * 查询编号规则列表
	 * @param filterMap
	 * @return
	 */
	public PageResult queryCustomNoList(Map<String, String> filterMap);
	
	/**
	 * 传入规则，返回编号
	 * @param custonNumber
	 * @return
	 */
	public String queryCunstomNumber(String custonNumber,Long customId);


	public List findAllBySql(String typeSql);

	public String queryTdmItem(String taskId);

	public TdmCustomNo goUpdateCustomNumber(String id);

	public void updateCustomNo(TdmCustomNo tcn);

	public TdmCustomNo queryTdmCustomNo(long parseLong);
	
	public void savePriority(String ids, String formid);
	
	public List queryBySql(String sql);
	
	public void executeBySql(String sql);
}
